import { createRouter, createWebHistory } from 'vue-router'
/* 配置路由的第一种方式:导入对应的组件 */
/* import MainLayout from '@/views/layout/MainLayout.vue' */

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '',
      component: () => import('@/views/layout/MainLayout.vue'),
      /* 重定向 */
      redirect: '/index',
      children: [
        //path:代表路径 name:代表访问的时候访问的名字 component:就是访问的组件
        { path: 'clazz', component: () => import('@/views/clazz/ClazzIndex.vue') },

        { path: 'dept', component: () => import('@/views/dept/DepIndex.vue') },

        { path: 'emp', component: () => import('@/views/emp/EmpIndex.vue') },

        { path: 'stu', component: () => import('@/views/stu/StuIndex.vue') },

        { path: 'index', component: () => import('@/views/index/HomeIndex.vue') },

        { path: 'log', component: () => import('@/views/log/LogIndex.vue') },

        { path: 'report/emp', component: () => import('@/views/report/emp/EmpIndex.vue') },

        { path: 'report/stu', component: () => import('@/views/report/stu/StuIndex.vue') },
      ],
    },
    { path: '/login', component: () => import('@/views/login/LoginIndex.vue') },
  ],
})

export default router
